const JWT = require('jsonwebtoken');
const { expressjwt } = require('express-jwt');
module.exports = {
  encode: (data, jwtkey, timeout = { expiresIn: '10d' }) => {
    return JWT.sign(data, jwtkey, timeout);
  },
  decode: (jwtkey) => {
    return expressjwt({
      secret: jwtkey,
      algorithms: ['HS256'],
    });
  },
};
